package app.modules.account.util.conversion;

import app.modules.account.dto.web.WebUserDTO;
import app.modules.account.persistence.entity.UserEO;
import app.modules.common.annotation.ConvertFrom;
import app.modules.common.annotation.ConvertTo;
import jasmine.framework.common.util.CollectionUtil;
import jasmine.framework.common.util.MapperUtil;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * @author mh.z
 */
public class UserConvertUtil {

    @ConvertFrom(UserEO.class)
    @ConvertTo(WebUserDTO.class)
    public static List<WebUserDTO> userEO2WebUserDTO(Collection<UserEO> recordList) {
        if (CollectionUtil.isEmpty(recordList)) {
            return Collections.emptyList();
        }

        return MapperUtil.mapToList(recordList, WebUserDTO.class);
    }

}
